package homework01;

import java.util.*;

/*
* 产生10个1-20之间的随机数，
* 要求随机数不能重复（List 和 Set 分别实现）*/
public class Random02 {
    public static void main(String[] args) {
        Random random=new Random();
        Set<Integer> set=new HashSet<Integer>();
        while (set.size()<10){
            set.add(random.nextInt(20)+1);
        }
        for (Integer inr:set){
            System.out.print(inr+" ");
        }
        System.out.println();
        System.out.println("================");
        List<Integer> list=new ArrayList<Integer>();
        while (list.size()<10){
            int i = random.nextInt();
            if (!list.contains(i)){
                list.add(i);
            }
        }
       for (Integer integer:list){
           System.out.print(integer+" ");
       }
    }
}
